const url = require('url');

var urlBaidu = 'https://www.baidu.com/help/index';

var url1 = url.resolve(urlBaidu, '/about');
console.log(url1);

var url2 = url.resolve(url1, '/list?a=123#admin');
console.log(url2);

var url3 = url.resolve(urlBaidu, '/list');
console.log(url3);

console.log(url.parse(url2));